<?php

namespace App\Http\Model;

use Illuminate\Database\Eloquent\Model;

class SkuModel extends Model
{
    protected $table = 'pre_sku';

    public function addSku($data){
        $res = \DB::table("pre_sku")->insertGetId($data);

        return $res;
    }

    public function updateSku($data){
        $res = \DB::table("pre_sku")->where("id",$data['id'])->update($data);

        return $res;
    }

    public function delSku($id){
        $res = \DB::table("pre_sku")->where("id",$id)->update([
            "states"=>9
        ]);

        return $res;
    }

    public function selectSku($id){
        $res = \DB::table("pre_sku")->where("id",$id)->where("states","!=",9)->get();

        return $res;
    }
}
